// service是获取数据

const {query}=require('../utils/query');

exports.loginService=({username,pwd})=>{
    let sql=`select * from login where username=? and pwd=?`;
    return query(sql,[username,pwd]);//查询用户是否存在
};

exports.getListService=async()=>{
    let sql=`select * from user`;
    return await query(sql)
};

exports.addUserService=async({id,username,nickname,sex,tel,email})=>{
    let sql=`insert into user (user_id,username,nickname,sex,tel,email) values(?,?,?,?,?,?)`;
    return await query(sql,[id,username,nickname,sex,tel,email])
};

exports.delService=async ({id})=>{
    const sql=`delete from user where user_id=?`;
    return await query(sql,[id])
}

